/*
 * fastaAlgParam.h
 *
 *  Created on: 30-09-2011
 *      Author: pawel
 */

#ifndef FASTAALGPARAM_H_
#define FASTAALGPARAM_H_
#include<string.h>
/**
 * Parameters of FASTA algorithm
 */
struct fastaAlgParam{
	size_t k_tuple;
	int w;
};
/**
 * Structure describes max scored fragment
 * of diagonal
 */
struct bestDiagFragment{
	size_t begin;
	size_t end;
	int score;
};
struct matrixPoint;
/**
 * This structure describes diagonal
 */
struct diagonal{
	/*
	 * Number of diagonal
	 */
	int diagNum;
	/**
	 * How many times diagonal was hit
	 */
	size_t count;
	/**
	 * Max scored fragment of diagonal
	 */
	bestDiagFragment bestFragment;
	/**
	 * Compare diagonals by number of hits.
	 * @return 1 if A->count < B->count
	 * 			-1 if else
	 */
	static int cntCompare(const void *ptrA,const void *ptrB);
	/**
	 * compare diagonals by number
	 * 	@return 1 if A->diagnum > B->diagnum
	 * 			-1 if else
	 */
	static int diagNumCompare(const void *ptrA,const void *ptrB);
	/*
	 * compare diagonals by begin position of best fragment
	 * @return 1 if(dPtrA->diagNum > dPtrB->diagNum)
	 * 			-1 if else
	 */
	static int bestFragmentBeginCompare(const void *ptrA,const void *ptrB);


	/*
	 * Converts initial position of max scored fragment on diagonal
	 * to initial position in dynamic programming matrix
	 */
	static matrixPoint diagToBegPoint(diagonal &diag);
	/*
	 * Converts end position of max scored fragment on diagonal
	 * to end position in dynamic programming matrix
	 */
	static matrixPoint diagToEndPoint(diagonal &diag);

};



#endif /* FASTAALGPARAM_H_ */
